home *** CD-ROM | disk | FTP | other *** search
/ Ahoy: Best of 1985 / Ahoy_Best_of_1985_1986_Double_L.d64 / file lock s'85 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  4KB  |  165 lines

  1. 5 rem file lock v0222/85
  2. 10 goto 10000
  3. 50 poke 198,0
  4. 52 get a$:if a$="" then goto 52
  5. 55 return
  6. 70 rem wait for return
  7. 80 poke 198,0:poke 204,0
  8. 85 get a$:poke 207,0:if a$<>chr$(13) then goto 85
  9. 90 poke 204,1:print " "chr$(157);:return
  10. 100 rem wait for key
  11. 105 poke 198,0:poke 204,0
  12. 110 get a$:poke 207,0:if a$="" then goto 110
  13. 115 poke 204,1:print " "chr$(157);:return
  14. 150 rem box routine
  15. 152 gosub 190
  16. 155 print chr$(117);:for i=0 to w-2:print chr$(99);:next i:print chr$(105);
  17. 158 for j=0 to h-2:rw=rw+1:gosub 190
  18. 160 print chr$(103);:for i=0 to w-2:print " ";:next i:print chr$(104);
  19. 161 next j
  20. 162 rw=rw+1:gosub 190
  21. 165 print chr$(106);:for i=0 to w-2:print chr$(99);:next i:print chr$(107);
  22. 170 print bl$;:return
  23. 190 rem set cursor locatiom
  24. 195 poke 214,rw:poke 211,cl:sys 58640:return
  25. 200 rem read directory
  26. 210 open 15,8,15,"i0:":open 2,8,2,"#"
  27. 220 tk=18:sc=1:nf=0
  28. 230 print#15,"u1";2;0;tk;sc
  29. 240 get#2,a$:a$=a$+chr$(0):t=asc(a$)
  30. 250 get#2,a$:a$=a$+chr$(0):s=asc(a$)
  31. 260 for f=0 to 7:rem 8 entries/sec
  32. 270 print#15,"b-p";2;f*32+2
  33. 275 get#2,a$:if a$="" then a$=chr$(0)
  34. 280 a=asc(a$):if asc(a$)=0 then goto 325
  35. 285 l$=">":if (a and 64) =0 then l$="[160]"
  36. 290 get#2,a$:get#2,a$
  37. 300 f$=l$+""
  38. 305 for i=0 to  15:get#2,a$:if a$="" then a$=chr$(0)
  39. 310 if asc(a$)=160 then goto 320
  40. 315 f$=f$+a$
  41. 320 next i
  42. 322 fl$(nf)=f$:s(nf)=sc:en(nf)=f:nf=nf+1
  43. 325 next f
  44. 330 if t<>0 then tk=t:sc=s:goto 230
  45. 335 close2:close15
  46. 340 nf=nf-1:return
  47. 400 rem print formatted screen
  48. 405 print chr$(147);:print hd$:print
  49. 410 rw=2:cl=0:h=20:w=19:gosub 150:
  50. 415 rw=2:cl=20:h=20:w=19:gosub 150
  51. 450 rem fill screen with files
  52. 455 rw=3:cl=1:gosub 190:zn=0
  53. 460 for j=0 to 18:i=pg*38+zn*19+j
  54. 462 if sf(i)=0 then print fl$(i);:goto 464
  55. 463 if sf(i)=1 then print rv$fl$(i)ro$;
  56. 464 rw=rw+1:gosub 190:next j
  57. 465 rw=3:cl=21:gosub 190:zn=1
  58. 470 for j=0 to 18:i=pg*38+zn*19+j
  59. 472 if sf(i)=0 then print fl$(i);:goto 474
  60. 473 if sf(i)=1 then print rv$fl$(i)ro$;
  61. 474 rw=rw+1:gosub 190:next j
  62. 475 zn=0:return
  63. 500 rem scratch
  64. 510 nc$="scratch  files "
  65. 515 gosub 800
  66. 519 open 15,8,15
  67. 520 for i=0 to nf:if sf(i)=0 then goto 540
  68. 525 f$=fl$(i):if left$(f$,1)=">" then goto 540
  69. 530 f$=right$(f$,len(f$)-1)
  70. 535 print#15,"s0:"f$:gosub 900
  71. 540 next i
  72. 550 close 15
  73. 599 return
  74. 600 rem lock
  75. 610 nc$="   lock  files "
  76. 615 gosub 800
  77. 619 open 15,8,15:open 2,8,2,"#"
  78. 620 for i=0 to nf:if sf(i)=0 then goto 660
  79. 630 gosub 690
  80. 635 get#2,a$:if a$="" then a$=chr$(0)
  81. 640 ft=asc(a$):ft=(ft or 64)
  82. 650 gosub 680
  83. 655 gosub 900
  84. 660 next i
  85. 670 close 2:close15:return
  86. 680 gosub 695:print#2,chr$(ft);
  87. 684 print#15,"b-p";2;0
  88. 685 print#15,"u2";2;0;18;s(i):return
  89. 690 print#15,"u1";2;0;18;s(i)
  90. 695 print#15,"b-p";2;en(i)*32+2:return
  91. 699 return
  92. 700 rem unlock
  93. 705 rw=1:cl=12:gosub 190
  94. 710 nc$=" unlock  files "
  95. 715 gosub 800
  96. 719 open 15,8,15:open 2,8,2,"#"
  97. 720 for i=0 to nf:if sf(i)=0 then goto 660
  98. 730 gosub 690
  99. 735 get#2,a$:if a$="" then a$=chr$(0)
  100. 740 ft=asc(a$):ft=(ft and 191)
  101. 750 gosub 680:gosub 900
  102. 760 next i
  103. 770 close 2:close15:return
  104. 800 rem select files
  105. 805 rw=1:cl=12:gosub 190:print yl$nc$;
  106. 806 rw=24:cl=0:gosub 190:print cd$;
  107. 807 rw=3:cl=18:gosub 190:print ar$;:j=0
  108. 810 gosub 50
  109. 811 if a$=cm$ then return
  110. 812 if a$=chr$(13) then gosub   820:goto 810
  111. 813 if a$=ar$ then goto 10000:rem exit and start over
  112. 814 if a$=chr$(19)  then gosub 190:print " ";:gosub 1000:goto 805
  113. 815 if a$=chr$(157) then gosub  890:goto 810
  114. 816 if a$=chr$(17)  then gosub  840:goto 810
  115. 817 if a$=chr$(145) then gosub  860:goto 810
  116. 818 if a$=chr$(29)  then gosub  880:goto 810
  117. 819 goto 810
  118. 820 tp=cl:cl=cl-17:i=pg*38+zn*19+j
  119. 821 ifsf(i)=1thengosub190:printchr$(146)fl$(cf+i);:sf(i)=0:goto 824
  120. 823 if sf(i)=0 then gosub 190:print chr$(18)fl$(cf+i)chr$(146);:sf(i)=1
  121. 824 cl=tp:return
  122. 840 i=pg*38+zn*19+j:if i=nf then return
  123. 841 j=j+1:if j>19 then j=19
  124. 844 gosub 190:print " ";
  125. 845 rw=rw+1:if rw>21 then rw=21:j=j-1
  126. 850 gosub 190:print ar$;:return
  127. 860 j=j-1:if j<0 then j=0
  128. 861 gosub 190:print " ";
  129. 865 rw=rw-1:if rw<3 then rw=3
  130. 870 gosub 190:print ar$;:return
  131. 880 if nf<pg*38+19  then return
  132. 885 gosub 190:print " ";:rw=3:cl=38:j=0:zn=1:gosub 190:print ar$;:return
  133. 890 rem
  134. 895 gosub 190:print " ";:rw=3:cl=18:j=0:zn=0:gosub 190:print ar$;:return
  135. 900 input#15,a$,b$,c$,d$
  136. 905 rw=23:cl=0:gosub 190:print "                                      ";
  137. 910 rw=23:cl=0:gosub 190:print a$"[160]"b$"[160]"c$"[160]"d$;:er=1:return
  138. 920 er=0:return
  139. 1000 if nf<38 then return
  140. 1005 pg=pg+1:if pg*38>nf then pg=0
  141. 1010 gosub 400:return
  142. 10000 clr:dim fl$(76),s(76),en(76),sf(76)
  143. 10005 bl$=chr$(154):yl$=chr$(158):rv$=chr$(18):ro$=chr$(146):ar$=chr$(95)
  144. 10010 poke 53280,11:poke 53281,0:print chr$(147)bl$;
  145. 10012 cd$=bl$+"  <crsr> <home>"+yl$+" moves "+bl$+" <rtrn>"+yl$+" selects [160]"+bl$
  146. 10015 hd$=chr$(18)+"          file lock v0222/85            "+chr$(146)
  147. 10020 print hd$;
  148. 10030 print:print "insert disk and hit "yl$"<return>"bl$;
  149. 10035 gosub 70:print:print "reading directory":
  150. 10040 gosub 200:pg=0:zn=0:gosub 400
  151. 10050 rw=24:cl=0:gosub 190
  152. 10055 printyl$ "scratch lock unlock page boot quit ?  "bl$chr$(157);
  153. 10056 gosub 100
  154. 10060 if a$="q" then end
  155. 10065 if a$="s" then print a$;:cm$=a$:gosub 500:goto 10000
  156. 10070 if a$="l" then print a$;:cm$=a$:gosub 600:goto 10000
  157. 10075 if a$="u" then print a$;:cm$=a$:gosub 700:goto 10000
  158. 10080 if a$="b" then print a$;:goto 10000
  159. 10085 if a$="p" then print a$;:gosub 1000
  160. 10090 goto 10050
  161. 60000 close 15:open 15,8,15,"i0:":close15
  162. 60001 save "@0:file lock v0222",8
  163. 61000 open 15,8,15:input#15,a$,b$,c$,d$
  164. 61001 print:print a$"[160]"b$"[160]"c$"[160]"d$:close15:stop
  165.